package com.zsc.wxm.ysh.anjo.service.base.utils;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * 描述：
 *
 * @author playmaker
 * @since 2021/2/28 0:31
 */
@Slf4j
@NoArgsConstructor
public class ResultJsonUtil<T> {

    /**
     * 将远程调用返回的结果转为对象
     *
     * @param object
     * @return
     */
    public T getResultData(Object object) {
        String dataString = JSON.toJSONString(object);
        log.info("转换结果：{}", JSON.parseObject(dataString, new TypeReference<T>() {
        }));
        return JSON.parseObject(dataString, new TypeReference<T>() {
        });
    }
}
